<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description("Make sure WebSocket transfer null character");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://127.0.0.1:8880/echo");
// \xff in string would be \xc3\xbf on websocket connection (UTF-8)
var expectedMessage = "Should Not\xff\0Split";

ws.onopen = function()
{
    debug("WebSocket open");
    ws.send(expectedMessage);
};

var msg;
ws.onmessage = function(messageEvent)
{
    msg = messageEvent.data;
    debug("msg should not be split by frame char \\xff\\0");
    shouldBe("msg", "expectedMessage");
    ws.close();
};

ws.onclose = function()
{
    debug("WebSocket closed");
    finishJSTest();
};

</script>
</body>
</html>
